

typedef struct LNode {
    int data;
    struct LNode* next;
} LNode,*LinkList;

LinkList create_list(LinkList* header,int m,int n) {
    int i;
    LinkList tnode,last;
    for(i=m; i<=n; i++) {
        tnode = (LNode*)malloc(sizeof(LNode));
        if(tnode) {
            //srand(i);
            //tnode->data = rand();
            tnode->data = i;
            tnode->next = NULL;
        }
        if(i==m) {
            *header = tnode;
            last = tnode;
        } else {
            last->next = tnode;
            last = tnode;
        }
    }
    return last;
}

void print_linklist(LinkList header){
    LinkList p;
    if(header){
        p = header;
        while(p){
            printf("%d ",p->data);
            p = p->next;
        }
        printf("\n");
    }
}
